<?php
/**
*@作者:MissZhang
*@邮箱:<787727147@qq.com>
*@创建时间:2022/10/20 21:46
*@说明:监控模型
*/
namespace app\common\model;


use think\Model;

class Monitors extends Model
{
    protected $pk = "id";
    // 定义时间戳字段名
    protected $createTime = 'add_time';
    //修改format类型
    protected $dateFormat = "Y-m-d H:i:s";
    public function getPkAttr($value,$data) {
        return $this->pk;
    }
    public function getOpenTextAttr($value, $data)
    {
        if ($data['is_open'] == 1) {
            return '是';
        }
        return '否';
    }
    public function cate(){
        return $this->hasOne(MonitorClass::class, 'id','c_id');
    }
}